Over the course of the last few lessons, we've successfully added auto updates to our app, but it's
all been a bit fragmented and I've yet to actually perform a complete update and release cycle.
So in this lesson, then we'll do exactly that.
We'll build and install our app at version one, but include a small bug on purpose will then fix the
bug in the project, rebuild a new version to patch the problem in version one published that new version
to get up and have our installed app update itself to the patched version.
So just a simple demonstration, really nothing new, but a roundup of what we've implemented and how
it will work in production.
I'll also be demonstrating this on both Mac and Windows this time around.
OK, to start, I'll get rid of this entire test directory.
So starting afresh and reset the app to version one, indicating a typical first release of an app.
This is the version will now build and install.
You can disregard the version one we already have on GitHub.
That's irrelevant as it's the same version.
Then to add a very obvious visual bug in the app, I'll make one of the main window elements read in
mind on HTML.
Let's say this plus button to open the modal.
Giving it a style of background color red that you do just something simple we can see as being fixed
when updating.
I'll also reduce the update check time a bit before building this, make that one and a half seconds
instead of three.
So we can now build this first release version for all platforms using our built command at the moment
that's only building four windows though so updater to build the default targets for Mac, Windows and
Linux and might as well do the same for the release build as we'll be using that in a minute.
Save this and build the app.
We're not publishing this as a release yet, so no need for tokens forward through this and done.
We now have version one built for all platforms.
I'll install the Mac app first, extract this target.
And move that version one up to my desktop.
I launch it.
And we see that red button, which will fix and update shortly.
Also confirming we have version one installed.
That's the app ready on Mac.
So next, I'll install it on Windows, moved to my shared project, drive WiFi and opened this directory
with Start Dot.
Yeah, same project as on my Mac just said we have the Redit installer.
Yes.
Her open that which installs Redit version one two windows and launches the app as you can see, the
same as on Mac with that red button.
So now having the app installed on both Mac and Windows, let's fix the bug, rebuild it as a patch
version and publish that build as a release in order to have the apps update themselves back in May.
Not html remove that red button color, this being our so-called fix and update the app version to a
patch version of one point zero point one, or in other words, newer than our installed versions.
Before building and publishing this, however, we first need to create this release draft on GitHub.
Click this draft a new release.
This new release being version one point zero point one, that patch update will build in a second released
title of read at one point zero point one patch.
And in the description, a simple changelog.
Fixed ad button color.
Save this as a draft in order to have Electron Baldev find it, and now we're ready to bolt and upload
this new release.
This time we'll need to get up Tolkan in order to access the release repo.
Print the token from the file.
It's safe to private G.H. Underscore token dot texte.
Copy this.
Setting the underscore Tolkan environment variable to that token value and executing NPM run release.
The boat starts, which I'll forward through, and as soon as each target is done, the upload to our
draft release in GitHub starts.
This might take a while, depending on your Internet connection.
So I'll fast forward through it again.
And done as mentioned before, don't worry about these incomplete upload lines.
It's the same target that finished here, just the terminal getting interrupted by new output.
OK, check this on GitHub.
I'll reload this draft and their audible targets with their respective latest Yamal files to facilitate
the update.
This is still unpublished, so go ahead and make the release, Leive.
Done.
We now have version one of Redit installed on both Mac and Windows with that red button, which is fixed
in our version one point zero point one patch update.
I'll head over to Windows first launch.
ReEdit.
And a few seconds later, we get the prompt to update now I'll say update.
So starting the download, skip through to that update being fully downloaded where we have prompted
a second time to install the new version.
Confirm.
Showing us the Windows installer as we selected not to have a silent install, and as soon as that's
done, the app is relaunched at version 1.0, point one confirmed by that button color now being fixed.
I'll do the same on Mac.
I'll actually add a few items to the app, this time to demonstrate the persistence after updating.
Dismiss the first update and add Electron Ge'ez dot org.
One item will do so restart the app so we can check for updates again.
This time, I'll confirm to start the download.
Fast forward.
Then, yes, to install and restart.
And as with Windows read, it is restarted at version one point zero point one with that button fixed
and most importantly, all our data from the previous version persisted.
So that covers a basic but good amount of update handling.
You can, of course, allow the option to manually check for updates from the app menu, for example,
and even provide download progress.
But as you can see, Electron Balde makes this a fairly straightforward process and one you should really
implement in any app not distributed via an official app store.